/**
 * @ author: 汪孟苹
 */
define(["jquery","template","bch/app/workBench/workBench.servers","bch/template/workBench/workBench.tpl"],function($,template,$servers,tpl){
	var ui = {};

	var drawQueue = function(data){
		return template("tpl_workBench_queue",data);
	}
	var drawWindowTop = function(data){
		return template("tpl_workBench_windowTop",data);
	}
	var drawWindowPt = function(data){
		return template("tpl_workBench_windowPt",data);
	}
	var drawQueueCard = function(data){
		return template("tpl_workBench_queueCard",data);
	}
	var drawBabyList = function(data){
		return template("tpl_workBench_babyList",data);
	}
	var drawFirstName = function(data){
		return template("tpl_workBench_firstName",data);
	}
	var drawArchiveWrap = function(data){
		return template("tpl_workBench_archiveWrap",data);
	}
	var drawUserOprList = function(data){
		return template("tpl_workBench_operateList",data);
	}
	/**
	 * 队列
	 */
	ui.queue = function(options){
		$("#"+options.id).html(tpl.queue());
		var h = drawQueue(options);
		$("#"+options.id).html(h);
	}
	/**
	 * 顶部和底部的统计
	 */
	ui.windowTop = function(options){
		$("#"+options.id).html(tpl.windowTop());
		var h = drawWindowTop(options.list);
		$("#"+options.id).html(h);
	}
	ui.windowPt = function(options){
		$("#"+options.id).append(tpl.windowPt());
		var h = drawWindowPt(options.list);
		$("#"+options.id).append(h);
	}
	/**
	 * 队列卡片
	 */
	ui.queueCard = function(options){
		options.dom.html(tpl.queueCard());
		var h = drawQueueCard($servers.handleQueueCard(options.list));
		options.dom.html(h);
	}
	/**
	 * 患者列表
	 */
	ui.babyList = function(options){
		var data = {
			rows:$servers.handleBabyList(options.list,options.rows)
		};
		$("#"+options.id).html(tpl.babyList());
		var h = drawBabyList(data);
		$("#"+options.id).html(h) ;
	}
	/**
	 * 姓初始化
	 */
	ui.firstNameInit = function(options){
		var data = {
			rows:$servers.firstNameData(options.list)
		};
		$("#"+options.id).html(tpl.firstName());
		var h = drawFirstName(data);
		$("#"+options.id).html(h);
	}
	/**
	 * 建档wrap
	 */
	ui.archiveWrap = function(options){
		options.dom.html(tpl.archiveWrap());
		var h = drawArchiveWrap(options);
		options.dom.html(h);
	}
	/**
	 * 今日门诊
	 */
	ui.userOprList = function(options){
		$("#"+options.id).html(tpl.userOprList());
		var h = drawUserOprList($servers.handleuserOprList(options));
		$("#"+options.id).html(h);
	}

	return ui;
});